import datetime
import jwt
from  django.conf import settings
key= settings.SECRET_KEY
class MyJwt:
    def gettoken(self,id,accout):
        user={
            "id":id,
            "username":accout,
            "exp":datetime.datetime.now()+datetime.timedelta(hours=1)
        }
        # key= settings.SECRET_KEY
        return "Bearer "+ jwt.encode(user,key,algorithm="HS256")
    def checktoken(self,token):
            return jwt.decode(token,key,algorithms="HS256")

pymyjwt = MyJwt()
# print(settings.SECRET_KEY)
# print(MyJwt().gettoken(1,"admin"))